package pl.ptemich.nov2k13.engine;

import java.util.ArrayList;
import java.util.List;

import pl.ptemich.tankwars.tools.HexTools;

public class AxialCoordinate {

  public int x;
  
  public int y;
  
  public AxialCoordinate(int x, int y) {
    this.x = x;
    this.y = y;
  }
  
  public List<AxialCoordinate> getNeighbors() {
    List<AxialCoordinate> neighbors = new ArrayList<>();
    
    neighbors.add(new AxialCoordinate(x + 1, y));
    neighbors.add(new AxialCoordinate(x - 1, y));
    neighbors.add(new AxialCoordinate(x, y + 1));
    neighbors.add(new AxialCoordinate(x, y - 1));
    neighbors.add(new AxialCoordinate(x + 1, y - 1));
    neighbors.add(new AxialCoordinate(x - 1, y + 1));
    
    return neighbors;
  }
  
  public String toString() {
    return "x:" + x + ",y:" + y;
  }

  public CubeCooridnate getCubeCoordinate() {
    return HexTools.getCubeCoordinate(this);
  }  
  
  public OffsetCooridinate getOffsetCoordinate() {
    return HexTools.getOffsetCoordinate(HexTools.getCubeCoordinate(this));  
  }
  
}
